﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<DateTime?>" %>
<%
    var routeData = HttpContext.Current.Request.RequestContext.RouteData;
    bool isEditAction = routeData.GetRequiredString("action").ToLower() == "edit";
 %>

<%= Html.Telerik().DatePicker()
        .Name(string.Format("{0}{1}", ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty), isEditAction ? "Value" : ""))
        .HtmlAttributes(new { id = ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty) + "_wrapper"})
                .Value(Model).Format("dd-MM-yyyy").OpenOnFocus(true).InputHtmlAttributes(new { maxlength = 0 })
%>

<%--Model > DateTime.MinValue ? Model : DateTime.Today--%>